package com.sun.sviewhelper;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioGroup;

import com.sun.sviewhelper.base.BaseActivity;
import com.sun.sviewhelper.databinding.ActivityTestBinding;
import com.sun.sviewhelper.demo.LinearActivity;
import com.sun.sviewhelper.demo.ListActivity;
import com.sun.sviewhelper.demo.RelativeActivity;

public class MainActivity extends BaseActivity<ActivityTestBinding> {
    private boolean isTrue = false;

    @Override
    protected void initView(Bundle savedInstanceState) {

        mBinding.relativeView.setOnClickListener(v -> {
            //startActivity(new Intent(this, RelativeActivity.class));
            mBinding.relativeView.setSelected(!mBinding.relativeView.isSelected());
        });
        mBinding.linearView.setOnClickListener(v -> {
            startActivity(new Intent(this, LinearActivity.class));
        });

       /* mBinding.updateView.setOnClickListener(v -> {
           // mBinding.layout.setSelected(!mBinding.layout.isSelected());
            mBinding.updateView.setSelected(!mBinding.updateView.isSelected());
        });*/

        /*mBinding.contentView.setText(isTrue ? "圆角阴影" : "一个");
        mBinding.clickLayout.setOnClickListener(v -> {
            *//*isTrue = !isTrue;
            mBinding.contentView.setText(isTrue ? "圆角阴影" : "一个");*//*
            mBinding.contentView.setSelected(!mBinding.contentView.isSelected());

            mBinding.textView.setChecked(!mBinding.textView.isChecked());
        });

        mBinding.radioGroup.setOnCheckedChangeListener((group, checkedId) -> {
            if(checkedId == R.id.rb_1) mBinding.rb1.setChecked(true);
            if(checkedId == R.id.rb_2) mBinding.rb2.setChecked(true);
        });*/

       /* mBinding.sLayout.setOnClickListener(v -> {
            mBinding.sLayout.setSelected(!mBinding.sLayout.isSelected());
        });

        mBinding.changeBtn.setOnClickListener(v -> {
            //   mBinding.updateView.setCornerRadius(Utils.dp2px(this,20));
        });

        mBinding.unableBtn.setOnClickListener(v -> {
            mBinding.sLayout.setEnabled(!mBinding.sLayout.isEnabled());
        });*/

        mBinding.normalView.setOnClickListener(v -> {
            mBinding.checkView.setEnabled(true);
            mBinding.checkView.setSelected(false);
        });

        mBinding.checkedView.setOnClickListener(v -> {
            mBinding.checkView.setSelected(true);
        });

        mBinding.checkToggleView.setOnClickListener(v -> {
            mBinding.checkToggleView.setSelected(!mBinding.checkToggleView.isSelected());
        });

        mBinding.unableView.setOnClickListener(v -> {
            mBinding.checkView.setEnabled(false);
        });
    }
}
